import axios from 'axios';

const service = axios.create({
  baseURL: 'https://bailian.aliyuncs.com/v2',
  withCredentials: true, // 跨域请求时发送cookie
  timeout: 50000,
});
// 请求拦截器
service.interceptors.request.use(
  (config) => {
    // console.log(config.headers);
    // console.log(config.url);
    return config;
  },
  (error) => {
    return Promise.reject(error);
  },
);

// 响应拦截器
service.interceptors.response.use(
  (response) => {
    const res = response.data;
    return res;
  },
  (error) => {
    return Promise.reject(error);
  },
);

export default service;
